package com.vegetable.modules.controller.finance;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.vegetable.common.annotation.SysLog;
import com.vegetable.common.utils.R;
import com.vegetable.modules.controller.AbstractController;
import com.vegetable.modules.entity.finance.dto.PaymentLogDTO;
import com.vegetable.modules.entity.finance.dto.PaymentLogQueryDTO;
import com.vegetable.modules.service.finance.PaymentLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 支付日志控制器
 *
 * @author Qoder
 */
@Slf4j
@RestController
@RequestMapping("/payment/log")
@Api(value = "支付日志", tags = "支付日志")
public class PaymentLogController extends AbstractController {

    @Autowired
    private PaymentLogService paymentLogService;

    /**
     * 分页查询支付日志
     */
    @SysLog(value = "分页查询支付日志")
    @PostMapping("/list")
    @ApiOperation(value = "分页查询支付日志", notes = "分页查询支付日志")
    public R<IPage<PaymentLogDTO>> queryPaymentLogs(@RequestBody PaymentLogQueryDTO queryDTO) {
        log.info("开始分页查询支付日志，查询参数: {}", queryDTO);
        return paymentLogService.queryPaymentLogs(queryDTO);
    }

    /**
     * 根据ID获取支付日志详情
     */
    @SysLog(value = "获取支付日志详情")
    @GetMapping("/info/{id}")
    @ApiOperation(value = "获取支付日志详情", notes = "根据ID获取支付日志详情")
    public R<PaymentLogDTO> getPaymentLogById(@PathVariable Long id) {
        log.info("开始获取支付日志详情，ID: {}", id);
        return paymentLogService.getPaymentLogById(id);
    }
}